#ifndef GALVOPARAMS_H
#define GALVOPARAMS_H

#include <QSettings>
#include "jsonconvert.h"

class GalvoParams : public JsonConvert
{
public:
    GalvoParams(){}


public slots:
    int jumpSpeed()
    {
        return mJumpSpeed;
    }

    void setJumpSpeed(int jumpSpeed)
    {
        mJumpSpeed = jumpSpeed;
    }


    void readFromFile()
    {
        QSettings settings("GlobalLaser.ini", QSettings::IniFormat);
        settings.beginGroup("GalvoParams");
        this->mJumpSpeed = settings.value("mJumpSpeed", 1500).toInt();
        settings.endGroup();
    }

    void writeToFile()
    {
        QSettings settings("GlobalLaser.ini", QSettings::IniFormat);
        settings.beginGroup("GalvoParams");
        settings.setValue("mJumpSpeed", mJumpSpeed);
        settings.endGroup();
    }

    QJsonObject toJsonObj() const
    {
        QJsonObject obj;
        obj["mJumpSpeed"] = mJumpSpeed;
        return obj;
    }

    void fromJsonObj(const QJsonObject& obj)
    {
        mJumpSpeed = obj["mJumpSpeed"].toInt();
    }

    bool operator ==(const GalvoParams& param){
        bool rel = true;
        rel &= (this->mJumpSpeed == param.mJumpSpeed);
        return rel;
    }

    void operator =(const GalvoParams& param){
        this->mJumpSpeed = param.mJumpSpeed;
    }
private:
    int mJumpSpeed = 0;
};

#endif // GALVOPARAMS_H
